const { Node, LinkedList } = require('./linkedList');
var removeElements = function (head, val) {
  if (head == null) {
    return
  }
  let dummyHead = new Node(0)
  dummyHead.next = head // 当前节点
  let curr = dummyHead
  console.log(curr === dummyHead);
  while (curr.next !== null) {
    if (curr.next.data === val) {
      curr.next = curr.next.next
    } else {
      curr = curr.next
    }
  }
  return dummyHead.next
};
let head = new LinkedList()
head.append(1)
head.append(2)
head.append(6)
head.append(3)
head.append(4)
head.append(5)
head.append(6)
console.log(removeElements(head.head, 6));
